Optimal. Leaf size=50 \[ -\frac{i x}{8}-\frac{i}{8 (-\tan (x)+i)}-\frac{i}{4 (\tan (x)+i)}-\frac{1}{8 (\tan (x)+i)^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0539709, antiderivative size = 50, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 13, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.308, Rules used = {3516, 848, 88, 203} \[ -\frac{i x}{8}-\frac{i}{8 (-\tan (x)+i)}-\frac{i}{4 (\tan (x)+i)}-\frac{1}{8 (\tan (x)+i)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3516
Rule 848
Rule 88
Rule 203
Rubi steps
\begin{align*} \int \frac{\sin ^2(x)}{i+\tan (x)} \, dx &=\operatorname{Subst}\left (\int \frac{x^2}{(i+x) \left (1+x^2\right )^2} \, dx,x,\tan (x)\right )\\ &=\operatorname{Subst}\left (\int \frac{x^2}{(-i+x)^2 (i+x)^3} \, dx,x,\tan (x)\right )\\ &=\operatorname{Subst}\left (\int \left (-\frac{i}{8 (-i+x)^2}+\frac{1}{4 (i+x)^3}+\frac{i}{4 (i+x)^2}-\frac{i}{8 \left (1+x^2\right )}\right ) \, dx,x,\tan (x)\right )\\ &=-\frac{i}{8 (i-\tan (x))}-\frac{1}{8 (i+\tan (x))^2}-\frac{i}{4 (i+\tan (x))}-\frac{1}{8} i \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (x)\right )\\ &=-\frac{i x}{8}-\frac{i}{8 (i-\tan (x))}-\frac{1}{8 (i+\tan (x))^2}-\frac{i}{4 (i+\tan (x))}\\ \end{align*}
Mathematica [A] time = 0.091249, size = 39, normalized size = 0.78 \[ -\frac{i \left (-3 i \sin (2 x)+\cos (2 x)+2 \tan ^{-1}(\tan (x)) (\tan (x)+i)+3\right )}{16 (\tan (x)+i)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.041, size = 47, normalized size = 0.9 \begin{align*}{\frac{{\frac{i}{8}}}{\tan \left ( x \right ) -i}}-{\frac{\ln \left ( \tan \left ( x \right ) -i \right ) }{16}}-{\frac{{\frac{i}{4}}}{i+\tan \left ( x \right ) }}-{\frac{1}{8\, \left ( i+\tan \left ( x \right ) \right ) ^{2}}}+{\frac{\ln \left ( i+\tan \left ( x \right ) \right ) }{16}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 2.12543, size = 89, normalized size = 1.78 \begin{align*} \frac{1}{32} \,{\left (-4 i \, x e^{\left (2 i \, x\right )} + e^{\left (6 i \, x\right )} - 2 \, e^{\left (4 i \, x\right )} - 2\right )} e^{\left (-2 i \, x\right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 0.425476, size = 31, normalized size = 0.62 \begin{align*} - \frac{i x}{8} + \frac{e^{4 i x}}{32} - \frac{e^{2 i x}}{16} - \frac{e^{- 2 i x}}{16} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.3412, size = 55, normalized size = 1.1 \begin{align*} -\frac{i \, \tan \left (x\right )^{2} + 3 \, \tan \left (x\right ) + 2 i}{8 \,{\left (\tan \left (x\right ) + i\right )}^{2}{\left (\tan \left (x\right ) - i\right )}} + \frac{1}{16} \, \log \left (\tan \left (x\right ) + i\right ) - \frac{1}{16} \, \log \left (\tan \left (x\right ) - i\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]